// pages/c1/c1.js
Page({
    data:{
        Sort: 'desc',
        locationLikeList: [],
        userInfo: ""
    },
    /*切换排序规则*/
    changeSort(){
        const { Sort } = this.data
        this.setData({
            Sort: Sort === 'desc' ? 'asc' : 'desc'
        })
    },
    /*获取商家信息*/
    async getLikeList(){
        const { result: { data }} = await wx.cloud.callFunction({
            name: 'getLikeList',
            data: {
                id: this.data.userInfo._id
            }
        })
        this.setData({
            locationLikeList : data
        })
    },
    async onLoad() {
        const userInfo = wx.getStorageSync('userInfo');
        this.setData({
            userInfo
        });
        if (userInfo) {
            await this.getLikeList();
        }
    }
    
})